﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Engine.Commands;
using Engine.Cameras;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Engine.Features.Water
{
    public class WaterUpdateParametersCommand : ICommand
    {
        
        private ICamera cam = null;
        private TextureCube texcube= null;
        private DinamicWater sb;
        private int update;
        public float waterHeight;
        private int WIDTH;
        private int HEIGHT;
        public Vector3 position;

        public WaterUpdateParametersCommand(ICamera cam, int width, int height, Vector3 position, float waterHeight)
        {
            this.cam = cam;

            this.WIDTH = width;
            this.HEIGHT = height;
            this.position = position;
            this.waterHeight = waterHeight;
            
            update = 1;
        }
        public WaterUpdateParametersCommand(ICamera cam)
        {
            this.cam = cam;
            update = 2;
        }

        #region ICommand Members

        public void execute()
        {
            if (update == 1)
            {
                sb.setParameters(cam,WIDTH,HEIGHT,position,waterHeight);
            }
            else if (update == 2)
            {
                sb.setParameters(cam);
            }
           
        }

        public void setTarget(object obj)
        {
            this.sb = obj as DinamicWater;
        }

        #endregion

        #region ICommand Members


        public string TargetName
        {
            get { return DinamicWater.MyName; }
        }

        #endregion
    }
    
}
